package com.yztstudy.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 商品的实体类
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "product")
@JsonIgnoreProperties(ignoreUnknown = true) // 不存在的变量就不转换
public class Product implements Serializable {

    public static final Long serialVersionUID = 1L;

    // 成员变量

    @TableId(value = "product_id", type = IdType.AUTO)
    @JsonProperty("product_id")
    private Integer productId; // 商品主键

    @TableField(value = "product_name")
    @JsonProperty("product_name")
    private String productName; // 商品名

    @TableField(value = "category_id")
    @JsonProperty("category_id")
    private Integer categoryId; // 类名主键

    @TableField(value = "product_title")
    @JsonProperty("product_title")
    private String productTitle; // 商品主题

    @TableField(value = "product_intro")
    @JsonProperty("product_intro")
    private String productIntro; // 商品介绍

    @TableField(value = "product_picture")
    @JsonProperty("product_picture")
    private String productPicture; // 商品的图片地址

    @TableField(value = "product_price")
    @JsonProperty("product_price")
    private Double productPrice; // 商品价格

    @TableField(value = "product_selling_price")
    @JsonProperty("product_selling_price")
    private Double productSellingPrice; // 售卖价格

    @TableField(value = "product_num")
    @JsonProperty("product_num")
    private Integer productNum; // 商品库存

    @TableField(value = "product_sales")
    @JsonProperty("product_sales")
    private Integer productSales; // 商品销量(已卖数量)
}
